#!/bin/bash
if [ ! -f build.sh ]; then
echo 'install must be run within its container folder' 1>&2
exit 1
fi

command -v go >/dev/null 2>&1 || {
    echo >&2 "程序编译运行需要 Golang 环境的支持，请检查是否安装了 1.8+ 的 Golang 版本.\n如果已经安装，请配置 \$GOROOT 和 \$GOPATH.  终止."; exit 1;
}

echo 'Build Begin....'

CURDIR=`pwd`
OLDGOPATH="$GOPATH"
export GOPATH="$CURDIR"

gofmt -w src
go install mysqlSinffier

export GOPATH="$OLDGOPATH"

echo 'Build finished.'
